package com.hgyc.mom.qms.entity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.*;

import com.hgyc.mom.common.annotation.Excel;
import com.hgyc.mom.core.annotation.DictColumn;
import com.hgyc.mom.core.annotation.TableDict;
import com.hgyc.mom.core.mybatis.EQ;
import com.hgyc.mom.core.mybatis.Like;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * <p>
 * 来料检验单
 * </p>
 *
 * @author fwj
 * @since 2025-09-27
 */
@Data
@TableName("qms_iqc")
@Schema(name="来料检验单对象", description="来料检验单对象")
public class QmsIqc implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "来料检验单ID")
    private Long id;

    @Excel(name = "来料检验单编号")
    @EQ
    @Schema(description = "来料检验单编号")
    private String code;

    @Schema(description = "检验模板ID")
    private Long templateId;

    @Schema(description = "来源单据ID")
    private Long sourceId;

    @Excel(name = "来源单据类型")
    @EQ
    @Schema(description = "来源单据类型")
    private String sourceType;

    @Excel(name = "来源单据编号")
    @EQ
    @Schema(description = "来源单据编号")
    private String sourceCode;

    @Schema(description = "来源单据行ID")
    private Long sourceLineId;

    @Excel(name = "供应商ID")
    @Schema(description = "供应商ID")
    @TableDict(table = "base_supplier", key = "id", columns = {
            @DictColumn(name = "supplier_name", alias = "supplierName")
    })
    private Long supplierId;

    @Excel(name = "产品物料ID")
    @EQ
    @Schema(description = "产品物料ID")
    @TableDict(table = "base_material", key = "id" , columns = {
            @DictColumn(name ="material_code", alias = "materialCode"),
            @DictColumn(name = "material_name", alias = "materialName"),
            @DictColumn(name = "materialSpec", alias = "materialSpec")
    })
    private Long materialId;

    @Schema(description = "最低检测数")
    private Long qtyMinCheck;

    @Schema(description = "最大不合格数")
    private Long qtyMaxUnqualified;

    @Excel(name = "本次接收数量")
    @Schema(description = "本次接收数量")
    private BigDecimal qtyReceipt;

    @Excel(name = "本次检测数量")
    @Schema(description = "本次检测数量")
    private Long qtyCheck;

    @Excel(name = "不合格数")
    @Schema(description = "不合格数")
    private Long qtyUnqualified;

    @Schema(description = "致命缺陷率")
    private BigDecimal crRate;

    @Schema(description = "严重缺陷率")
    private BigDecimal majRate;

    @Schema(description = "轻微缺陷率")
    private BigDecimal minRate;

    @Schema(description = "致命缺陷数量")
    private Long crQty;

    @Schema(description = "严重缺陷数量")
    private Long majQty;

    @Schema(description = "轻微缺陷数量")
    private Long minQty;

    @Excel(name = "检测结果")
    @EQ
    @Schema(description = "检测结果")
    private String checkResult;

    @Excel(name = "来料日期")
    @Schema(description = "来料日期")
    private LocalDateTime receiptDate;

    @Excel(name = "检测日期")
    @Schema(description = "检测日期")
    private LocalDateTime inspectDate;

    @Excel(name = "检测人员")
    @Schema(description = "检测人员")
    @TableDict(table = "sys_user", key = "id", columns = {
            @DictColumn(name = "name", alias = "inspectorName")
    })
    private Long inspector;

    @Excel(name = "单据状态")
    @Schema(description = "单据状态")
    private String status;

    @Schema(description = "备注")
    private String remark;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建者")
    private Long createBy;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @Schema(description = "更新者")
    private Long updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

}
